package com.yiji.fintech.musfinance.common.strategy.notify;

import com.acooly.core.utils.mapper.BeanCopier;
import com.yiji.fintech.musfinance.center.notify.order.SignNotifyOrder;
import com.yiji.fintech.musfinance.center.notify.order.base.NotifyOrderBase;
import com.yiji.fintech.musfinance.center.notify.order.thirdparty.PactNotifyOrder;
import com.yiji.fintech.musfinance.common.annotation.NotifyAnnotation;
import com.yiji.fintech.musfinance.service.TransactionSignService;
import org.springframework.stereotype.Service;

/**
 * 签约异步通知
 * Created by ouwen@yiji.com} on 2017/10/15.
 */
@Service
@NotifyAnnotation(orderClass = SignNotifyOrder.class,dbServiceClass = TransactionSignService.class)
public class SignNotifyStrategy extends AbstractNotifyStrategy {
    @Override
    protected PactNotifyOrder initPackNotifyOrder(NotifyOrderBase notifyOrder) {
        SignNotifyOrder signNotifyOrder = (SignNotifyOrder)notifyOrder;
        PactNotifyOrder pactNotifyOrder = new PactNotifyOrder();
        BeanCopier.copy(notifyOrder,pactNotifyOrder,BeanCopier.CopyStrategy.IGNORE_NULL, BeanCopier.NoMatchingRule.IGNORE,null);
        pactNotifyOrder.setTradeType(entity.getTradeType());
        pactNotifyOrder.setProtocolNo(signNotifyOrder.getProtocolNo());
        pactNotifyOrder.setProtocolChildNo(signNotifyOrder.getProtocolChildNo());
        return pactNotifyOrder;
    }
}
